package com.digitalchina.lxnsy.activity.old;

import android.os.Bundle;
import androidx.viewpager.widget.ViewPager;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.adapter.TabViewPagerAdapter;
import com.digitalchina.lxnsy.base.BaseActivity;
import com.digitalchina.lxnsy.entity.PagerItemVO;
import com.digitalchina.lxnsy.fragment.PestFragment;
import com.digitalchina.lxnsy.view.MyTabLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：郑皓
 * 创建时间：2019/4/17 11:15
 * 修改备注：
 * ================================================
 */
public class PestListActivity extends BaseActivity {
    @Bind(R.id.tab)
    MyTabLayout tab;
    @Bind(R.id.viewpager)
    ViewPager viewpager;


    private String farmOperationId = ""; // 农事操作id
    private String productStandardId = ""; // 生产标准id
    private String ID;

    /*每个 tab 的 item*/
    private List<PagerItemVO> mList = new ArrayList<>();

    @Override
    public void setLayout() {
        setContentLayout(R.layout.activity_new_agriculture);
        setTitle("病虫草害");
    }

    @Override
    public void initMember() {
        ID = (String) getIntent().getSerializableExtra("ID");
        String array[] = ID.split("&");

        farmOperationId = array[0];
        productStandardId = array[1];


        PestFragment new1 = new PestFragment();
        Bundle b1 = new Bundle();
        b1.putString("typeCode", "bcch_bh");
        b1.putString("farmOperationId", farmOperationId);
        b1.putString("productStandardId", productStandardId);
        new1.setArguments(b1);

        PestFragment new2 = new PestFragment();
        Bundle b2 = new Bundle();
        b2.putString("typeCode", "bcch_ch");
        b2.putString("farmOperationId", farmOperationId);
        b2.putString("productStandardId", productStandardId);
        new2.setArguments(b2);

        mList.add(new PagerItemVO("病害", new1));
        mList.add(new PagerItemVO("虫害", new2));

        viewpager.setAdapter(new TabViewPagerAdapter(getFragmentManager(), mList));
        viewpager.setOffscreenPageLimit(3);
        tab.setViewPager(viewpager);
    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
